package light.head.controller.mobile;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import light.head.constant.Parm;
import light.head.constant.Url;
import light.head.dao.mobile.MobileAnnCollectDAO;
import light.head.dao.mobile.MobileAnnouncementDAO;
import light.head.framework.base.SupporterController;
import light.head.framework.entity.PageBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 查看公告
 * @author yangguanghe @date 2014-5-28 @time 上午11:50:18
 *
 */
@Controller
@RequestMapping(Url.MOBILE_ANNCOLLECT)
public class MobileAnnCollectController extends SupporterController {

	private MobileAnnouncementDAO maDAO;
	private MobileAnnCollectDAO macDAO;
	
	
	@RequestMapping(Url.INIT)
	public ModelAndView init (HttpServletRequest request, HttpServletResponse response) throws Exception {
		return new ModelAndView(Url.MOBILE_ANNCOLLECT_INIT);
	}
	
	@RequestMapping(Url.QUERY)
	public ModelAndView list (HttpServletRequest request, HttpServletResponse response) throws Exception {
		PageBean pb = createPageBean(request);
		Map<String,String> map = createQueryMapByParmName(request, Parm.TITLE, Parm.ST, Parm.ET);
		
		maDAO.findByMap(cu_organCode(request), map, pb);
		
		request.setAttribute(Parm.PAGE_BEAN, pb);
		return new ModelAndView(Url.MOBILE_ANNCOLLECT_LIST);
	}
	
	

	// 查看我的收藏, 未启用
	public ModelAndView shouchang (HttpServletRequest request, HttpServletResponse response) throws Exception {
		macDAO.findByMap();
		return new ModelAndView(Url.MOBILE_ANNCOLLECT_INIT);
	}
	
	
	
	
	

	@Autowired
	public void setMaDAO(MobileAnnouncementDAO maDAO) {
		this.maDAO = maDAO;
	}

	@Autowired
	public void setMacDAO(MobileAnnCollectDAO macDAO) {
		this.macDAO = macDAO;
	}
	
	
	
}
